#include <stdio.h>
int main(void)
{
	int x,y,sum,s;
	x=y=1;
	scanf("%d",&s);
	while(1){
		sum=x+y;
		x=y;
		y=sum;
		 if(sum>s)
			 break;
	}
	printf("%d\n",sum);
	return 0;
}